

	**********************************************************************
	**
	**
	**		NAME:			The Political Economy of Suffrage Reform
	**		PUBLICATION:	Journal of Historical Political Economy
	**
	**		AUTHORS:		Gary Cox
	**						Adriane Fresh
	**						Sebastian Saiegh
	**						
	**		VERSION: 		December 8, 2022
	**
	**		DETAILS: 		Table and Figure replication file.
	**						Appendix tales and figures included.
	**					  
	**				 	
	**
	**		SOFTWARE:	Final version was coded and run in Stata 17.0.		
	**
	**
	**********************************************************************
	
	
	
	
	
	
	


			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* please set your working directory for your data and output here
*-------------------------------------------------------------------------------


* working directory for the associated data
*------------------------------------------

global data = "YOUR FILE PATH HERE"




* working directory for the output files
*---------------------------------------

global output = "YOUR FILE PATH HERE"


	

	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* preliminaries
*-------------------------------------------------------------------------------


* clear
*------

clear
set more off, perm









			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	
							** FIGURES **
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* FIGURE 1: Newspaper corpus trends
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Figure_1.dta, clear




* set the data
*-------------

tsset year




* plot
*-----


# delimit ;

twoway 
	
	// line
	(line riots year
		,  lcolor(gs1) lwidth(medthick) lpattern(line) xline(1832, lcolor(gs11)) )
	(line reform year	
		,  lcolor(gs6) lwidth(medthick) lpattern(shortdash))	
	
	
	// scatter
	(scatter riots year
		,  mcolor(gs1) msize(small) msymbol(circle))
	(scatter reform year	
		,  mcolor(gs6) msize(small) msymbol(circle_hollow))		

		
		
		,
		yscale(noline)
		xscale(noline)
		
		text(.0395 1832 "Great Reform Act", size(medsmall) place(e))
		
		xsize(8.5)
		ysize(3)

		title("", color(black) size(medsmall) pos(11) ) 
		xlab( 1750(25)1850, 
			labsize(medsmall) ) 
		ylab( , 
			angle(hori) labsize(medsmall) nogrid  )
		xtitle("Year" , 
			color(black) size(large) )
		ytitle("Percentage of Documents", 
			color(black) size(large)  )
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
		legend(order(
				1 "Riot mentions"
				2 "Reform mentions"
				)
			cols(2)
			pos(6)
			
			region( color(none) )
			size(large)
			)
		
		;

# delimit cr



	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_1.png", replace





	


			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	
					    ** APPENDIX FIGURES **
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Figure D1: municipal police expenditures
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Figure_D1.dta, replace




* left plot
*----------

#delimit ;


twoway 	

		(line avg_exp_perc_1 year 
				if tag_yearp == 1 & anypolice == 1, lcolor(black))

		(scatter avg_exp_perc_1 year 
				if tag_yearp == 1 & anypolice == 1, mcolor(black))

		
		,
		
		xsize(3.5)
		ysize(3)
		xscale(noline )
		yscale(noline )
		title( "" )
		ylab(  , 
			angle(hori) labsize(medsmall) nogrid )
		xlab(  , 
			labsize(medsmall) )
		xtitle(" " , 
			color(black) size(large) )
		ytitle(" ", 
			color(black) size(large)  )
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none) )
		legend(order(
				1 "Avg. police expenditure / total expenditure"
				)
			cols(2)
			pos(6)
			
			region( color(none) )
			size(medium)
			)
		
		;
#delimit cr



		* output
		*-------
		
		cd "${output}"
		graph export "Figure_D1_a.png", replace


		
		
		
* right plot
*-----------		
		
		
#delimit ;


twoway 	

		(line avg_exp_pc_1 year 
				if tag_yearp == 1 & anypolice == 1, lcolor(gs6) lpattern(dash))

		(scatter avg_exp_pc_1 year 
				if tag_yearp == 1 & anypolice == 1, mcolor(gs6))

		
		,
		
		xsize(3.5)
		ysize(3)
		xscale(noline )
		yscale(noline )
		title( "" )
		ylab(  , 
			angle(hori) labsize(medsmall) nogrid )
		xlab(  , 
			labsize(medsmall) )
		xtitle(" " , 
			color(black) size(large) )
		ytitle(" ", 
			color(black) size(large)  )
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none) )
		legend(order(
				1 "Avg. police expenditure per capita"
				)
			cols(2)
			pos(6)
			
			region( color(none) )
			size(medium)
			)
		
		;
#delimit cr

		
		* output
		*-------
		
		cd "${output}"
		graph export "Figure_D1_b.png", replace

		
		
		
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
		
		
		
*-------------------------------------------------------------------------------
* Figure D2: Distribution of rioting by distance to municipal borough
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Figure_D2.dta, clear




* plot
*-----


# delimit ;

twoway 
	
	// line
	(kdensity total_offenders_10km  if total_offenders_10km < 500 & year == 1831
		,  lcolor(gs1) lwidth(medthick) lpattern(line)  )

	
	
	// line
	(kdensity total_offenders_20km  if total_offenders_20km < 500 & year == 1831
		,  lcolor(gs6) lwidth(medthick) lpattern(dash)  )
		
	
	
	// line
	(kdensity total_offenders_30km  if total_offenders_30km < 500 & year == 1831
		,  lcolor(gs11) lwidth(medthick) lpattern(dash_dot)  )	


		
		
		,
		yscale(noline)
		xscale(noline)

		
		xsize(8.5)
		ysize(3)

		title("", color(black) size(medsmall) pos(11) ) 
		xlab( , 
			labsize(medsmall) ) 
		ylab( , 
			angle(hori) labsize(medsmall) nogrid  )
		xtitle("Rioters" , 
			color(black) size(large) )
		ytitle("Density", 
			color(black) size(large)  )
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
		legend(order(
				1 "Rioters w/in 10km"
				2 "Rioters w/in 20km"
				3 "Rioters w/in 30km"
				)
			cols(3)
			pos(6)			
			region( color(none) )
			size(medium)
			)
		
		;

# delimit cr

	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_D2.png", replace




	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Figure D3: yeomanry and police
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Figure_D3.dta, clear



* plot
*-----


# delimit ;

twoway 
	
	// line
	(line yeo year  if year >= 1818 & year <= 1838
		,  lcolor(gs4) lwidth(medthick) lpattern(dash)  )

	(line pol year  if year >= 1818 & year <= 1838
		,  lcolor(gs2) lwidth(medthick) lpattern(line)  )
		
		
		,
		yscale(noline)
		xscale(noline)

		
		xsize(4.5)
		ysize(3)

		title("", color(black) size(medsmall) pos(11) ) 
		xlab( , 
			labsize(medsmall) ) 
		ylab( , 
			angle(hori) labsize(medsmall) nogrid  )
		xtitle("Year" , 
			color(black) size(large) )
		ytitle("Total Annual Expenditures" "(Thousands of Pounds)", 
			color(black) size(large)  )
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
		legend(order(
				1 "Yeomanry"
				2 "Professional Police Forces"
				)
			cols(3)
			pos(6)			
			region( color(none) )
			size(medium)
			)
		
		;

# delimit cr

	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_D3.png", replace	

	
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* FIGURE E1: riots and disorder debate words
*-------------------------------------------------------------------------------
		

* use
*----

cd "${data}"
use Figure_E1.dta, clear		
		
		


* plot
*-----


# delimit ;

twoway 
	
	// line
	(line riots  date  if date >= 1803 & date <= 1853
		,  lcolor(gs4) lwidth(medthick) lpattern(line)  )

	
		
		
		,
		yscale(noline)
		xscale(noline)

		
		xsize(4.5)
		ysize(3)

		title("", color(black) size(medsmall) pos(11) ) 
		xlab( , 
			labsize(medsmall) ) 
		ylab( , 
			angle(hori) labsize(medsmall) nogrid  )
		xtitle("Year" , 
			color(black) size(large) )
		ytitle("Frequency (hits per million of words)", 
			color(black) size(large)  )
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
		legend(
			cols(3)
			pos(6)			
			region( color(none) )
			size(medium)
			)
		
		;

# delimit cr

	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_E1.png", replace		
		
		
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* FIGURE E2: corn law mentions in debates
*-------------------------------------------------------------------------------
		
		
* use
*----

cd "${data}"
use Figure_E2.dta, clear		
		
		


* plot
*-----


# delimit ;

twoway 
	
	// line
	(line corn_law  date  if date >= 1803 & date <= 1853
		,  lcolor(gs4) lwidth(medthick) lpattern(line)  )

	
		
		
		,
		yscale(noline)
		xscale(noline)

		
		xsize(4.5)
		ysize(3)

		title("", color(black) size(medsmall) pos(11) ) 
		xlab( , 
			labsize(medsmall) ) 
		ylab( , 
			angle(hori) labsize(medsmall) nogrid  )
		xtitle("Year" , 
			color(black) size(large) )
		ytitle("Frequency (hits per million of words)", 
			color(black) size(large)  )
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
		legend(
			cols(3)
			pos(6)			
			region( color(none) )
			size(medium)
			)
		
		;

# delimit cr

	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_E2.png", replace
	
	
	
	
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* FIGURE E3: riots and threat in parliamentary discussions of reform
*-------------------------------------------------------------------------------
	

* use
*----

cd "${data}"
use Figure_E3.dta, clear	
	
	
	

* temp file
*----------

preserve


tempname memhold
tempfile results
postfile `memhold' beta1 se1  sample  controls  sortid		using `results'
	
	
	
	
* regressions
*------------
	
	// counties count
	
reg rev_2_i  ncriots  		if county_i == 1, vce(robust)
post `memhold' 	(_b[ncriots]) (_se[ncriots]) (1) (0) (0)
	
reg rev_2_i  ncriots  		if county_i == 1, vce(robust)
post `memhold' 	(_b[ncriots]) (_se[ncriots]) (1) (0) (1)

reg rev_2_i  ncriots  economictrend2 rottenindex density1831 agg_type1		if county_i == 1, vce(robust)
post `memhold' 	(_b[ncriots]) (_se[ncriots]) (1) (0) (2)

reg rev_2_pspeech  ncriots  		if county_i == 1, vce(robust)
post `memhold' 	(_b[ncriots]) (_se[ncriots]) (1) (0) (3)

reg rev_2_pspeech  ncriots  economictrend2 rottenindex density1831 agg_type1		if county_i == 1, vce(robust)
post `memhold' 	(_b[ncriots]) (_se[ncriots]) (1) (0) (4)


	// counties ln(count + 1)

reg rev_2_i  ncriots  		if county_i == 1, vce(robust)
post `memhold' 	(_b[ncriots]) (_se[ncriots]) (1) (0) (4.5)

reg rev_2_i  lnncriots  	if county_i == 1, vce(robust)
post `memhold' 	(_b[lnncriots]) (_se[lnncriots]) (1) (0) (5)

reg rev_2_i  lnncriots  economictrend2 rottenindex density1831 agg_type1	if county_i == 1, vce(robust)
post `memhold' 	(_b[lnncriots]) (_se[lnncriots]) (1) (0) (6)

reg rev_2_pspeech  lnncriots  	if county_i == 1, vce(robust)
post `memhold' 	(_b[lnncriots]) (_se[lnncriots]) (1) (0) (7)

reg rev_2_pspeech  lnncriots  economictrend2 rottenindex density1831 agg_type1		if county_i == 1, vce(robust)
post `memhold' 	(_b[lnncriots]) (_se[lnncriots]) (1) (0) (8)





* post close
*-----------

postclose `memhold'
use `results', clear



* generate ci
*------------

gen cihi1 = beta1 + 1.96*se1
gen cilo1 = beta1 - 1.96*se1




* plot upper left
*----------------

#delimit;

	twoway

		( rcap cihi1 cilo1 sortid  	if sortid <= 4 & sortid > 0
			, lwidth(thick) color(black) msize(tiny) vertical
			  yline(0, lwidth(small) lcolor(gs9) lpattern(dash) )
				text(-.004 1.35 "Any revolution mention", place(c) size(small))
				text(-.004 3.35 "% Speeches mention revolution", place(c) size(small) )
			  )
		( scatter beta1 sortid 		if sortid <= 4 & sortid > 0
			, color(black)  msize(large) )
		
		( scatter beta1 sortid 		if sortid== 0
			, color(none)  msize(large) )


			,

		xlabel(0 " " 1 "no controls" 2 "controls" 3 "no controls" 4 "controls"
				,
			tlength(0) angle(45) nogrid labsize(small)  )
		xtitle(" ",
			angle(hori)	color(black) size(medium) )


		ylabel( ,
			tlength(0) angle(hori) labsize(medlarge) tlcolor(black) labcolor(black) nogrid )
		ytitle("",
			color(black) size(large) )

		xscale(noline)
		yscale(noline)
		graphregion(fcolor(white) lcolor(white) )
		plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
		title("County-Only Results, Count of Riots",
			color(black) size(medium) pos(12) )
		subtitle("Sample: 1830-32 speeches; N=26",
			color(black) justification(center))
		legend(off  )
		;

		#delimit cr




	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_E3_a.png", replace
	
	
	

* plot upper right
*-----------------

#delimit;

	twoway

		( rcap cihi1 cilo1 sortid  	if sortid >= 5
			, lwidth(thick) color(black) msize(tiny) vertical
			  yline(0, lwidth(small) lcolor(gs9) lpattern(dash) )
				text(-.22 5.35 "Any revolution mention", place(c) size(small))
				text(-.22 7.35 "% Speeches mention revolution", place(c) size(small) )
			  )
		( scatter beta1 sortid 		if sortid >= 5
			, color(black)  msize(large) )
		
		( scatter beta1 sortid 		if sortid== 4.5
			, color(none)  msize(large) )
			
			,

		xlabel(4.5 " " 5 "no controls" 6 "controls" 7 "no controls" 8 "controls"
				,
			tlength(0) angle(45) nogrid labsize(small)  )
		xtitle(" ",
			angle(hori)	color(black) size(medium) )


		ylabel( ,
			tlength(0) angle(hori) labsize(medlarge) tlcolor(black) labcolor(black) nogrid )
		ytitle("",
			color(black) size(large) )

		xscale(noline)
		yscale(noline)
		graphregion(fcolor(white) lcolor(white) )
		plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
		title("County-Only Results, ln(Count of Riots + 1)",
			color(black) size(medsmall) pos(12) )
		subtitle("Sample: 1830-32 speeches; N=26",
			color(black) justification(center))
		legend(off  )
		;

		#delimit cr




	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_E3_b.png", replace	
	
	
	
	restore	
	
	
	

* temp file
*----------

preserve


tempname memhold
tempfile results
postfile `memhold' beta1 se1  sample  controls  sortid		using `results'
	
	
	
	
* regressions
*------------  
	
reg rev_2_i  nriots_constit  		if county_i == 0, vce(robust)
post `memhold' 	(_b[nriots_constit]) (_se[nriots_constit]) (1) (0) (0)
	
reg rev_2_i  nriots_constit  		if county_i == 0, vce(robust)
post `memhold' 	(_b[nriots_constit]) (_se[nriots_constit]) (1) (0) (1)

reg rev_2_i  nriots_constit  economictrend2 rottenindex density1831 agg_type1		if county_i == 0, vce(robust)
post `memhold' 	(_b[nriots_constit]) (_se[nriots_constit]) (1) (0) (2)

reg rev_2_pspeech  nriots_constit  		if county_i == 0, vce(robust)
post `memhold' 	(_b[nriots_constit]) (_se[nriots_constit]) (1) (0) (3)

reg rev_2_pspeech  nriots_constit  economictrend2 rottenindex density1831 agg_type1		if county_i == 0, vce(robust)
post `memhold' 	(_b[nriots_constit]) (_se[nriots_constit]) (1) (0) (4)



reg rev_2_i  lnnriots_constit  		if county_i == 0, vce(robust)
post `memhold' 	(_b[lnnriots_constit]) (_se[lnnriots_constit]) (1) (0) (4.5)

reg rev_2_i  lnnriots_constit  	if county_i == 0, vce(robust)
post `memhold' 	(_b[lnnriots_constit]) (_se[lnnriots_constit]) (1) (0) (5)

reg rev_2_i  lnnriots_constit  economictrend2 rottenindex density1831 agg_type1	if county_i == 0, vce(robust)
post `memhold' 	(_b[lnnriots_constit]) (_se[lnnriots_constit]) (1) (0) (6)

reg rev_2_pspeech  lnnriots_constit  	if county_i == 0, vce(robust)
post `memhold' 	(_b[lnnriots_constit]) (_se[lnnriots_constit]) (1) (0) (7)

reg rev_2_pspeech  lnnriots_constit  economictrend2 rottenindex density1831 agg_type1		if county_i == 0, vce(robust)
post `memhold' 	(_b[lnnriots_constit]) (_se[lnnriots_constit]) (1) (0) (8)



* post close
*-----------

postclose `memhold'
use `results', clear



* generate ci
*------------

gen cihi1 = beta1 + 1.96*se1
gen cilo1 = beta1 - 1.96*se1




* plot lower left
*----------------

#delimit;

	twoway

		( rcap cihi1 cilo1 sortid  	if sortid <= 4 & sortid > 0
			, lwidth(thick) color(gs6) msize(tiny) vertical
			  yline(0, lwidth(small) lcolor(gs9) lpattern(dash) )
				text(-.03 1.35 "Any revolution mention", place(c) size(small))
				text(-.03 3.35 "% Speeches mention revolution", place(c) size(small) )
			  )
		( scatter beta1 sortid 		if sortid <= 4 & sortid > 0
			, color(gs6)  msize(large) msymbol(Oh) )
		
		( scatter beta1 sortid 		if sortid== 0
			, color(none)  msize(large) )


			,

		xlabel(0 " " 1 "no controls" 2 "controls" 3 "no controls" 4 "controls"
				,
			tlength(0) angle(45) nogrid labsize(small)  )
		xtitle(" ",
			angle(hori)	color(black) size(medium) )


		ylabel( ,
			tlength(0) angle(hori) labsize(medlarge) tlcolor(black) labcolor(black) nogrid )
		ytitle("",
			color(black) size(large) )

		xscale(noline)
		yscale(noline)
		graphregion(fcolor(white) lcolor(white) )
		plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
		title("Borough-Only Results, Count of Riots w/in 10k",
			color(black) size(medium) pos(12) )
		subtitle("Sample: 1830-32 speeches; N=126",
			color(black) justification(center))
		legend(off  )
		;

		#delimit cr




	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_E3_c.png", replace
	

	
	

* plot lower right
*-----------------

#delimit;

	twoway

		( rcap cihi1 cilo1 sortid  	if sortid >= 5
			, lwidth(thick) color(gs6) msize(tiny) vertical
			  yline(0, lwidth(small) lcolor(gs9) lpattern(dash) )
				text(-.29 5.35 "Any revolution mention", place(c) size(small))
				text(-.29 7.35 "% Speeches mention revolution", place(c) size(small) )
			  )
		( scatter beta1 sortid 		if sortid >= 5
			, color(gs6)  msize(large) msymbol(Oh) )
		
		( scatter beta1 sortid 		if sortid== 4.5
			, color(none)  msize(large) )
			
			,

		xlabel(4.5 " " 5 "no controls" 6 "controls" 7 "no controls" 8 "controls"
				,
			tlength(0) angle(45) nogrid labsize(small)  )
		xtitle(" ",
			angle(hori)	color(black) size(medium) )


		ylabel( ,
			tlength(0) angle(hori) labsize(medlarge) tlcolor(black) labcolor(black) nogrid )
		ytitle("",
			color(black) size(large) )

		xscale(noline)
		yscale(noline)
		graphregion(fcolor(white) lcolor(white) )
		plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none))
		title("Borough-Only Results, ln(Count of Riots w/in 10k + 1)",
			color(black) size(medsmall) pos(12) )
		subtitle("Sample: 1830-32 speeches; N=126",
			color(black) justification(center))
		legend(off  )
		;

		#delimit cr




	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_E3_d.png", replace	
	
	
	
	restore
		
		
		
		
		
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* FIGURE E4: influence and revolutionary threat in reform debates
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Figure_E4.dta, clear




* plot
*-----

# delimit ;

twoway 

	(line perc_influence_norm monthyear  	if year >= 1830 
		, lcolor(black) )

	(scatter perc_influence_norm monthyear 	if year >= 1830 
		, mcolor(black) msize(small)  )
		
		
	(line perc_revolution2_norm monthyear   	if year >= 1830 
		, lcolor(gs8) lpattern(dash))

	(scatter perc_revolution2_norm monthyear 	if year >= 1830 
		, mcolor(gs8) msize(small) msymbol(Oh) xline(1830.916) xline(1830.75) xline(1831.36))

	
	,
	
		text(0.99 1830.916 "Wellington's Fall", place(e) size(vsmall))
		text(0.99 1830.75 "First Swing Riot", place(w) size(vsmall))
		text(0.99 1831.36 "Start 1831 Election", place(e) size(vsmall))
	
		yscale(noline)
		xscale(noline)
		
		xsize(7.0)
		ysize(3)

		title("", color(black) size(medsmall) pos(11) ) 
		
		xlab( 1830(1)1833, 
			labsize(medsmall) ) 
		ylab( 0(.2)1, 
			angle(hori) labsize(medsmall) nogrid  )
		
		xtitle("Year" , 
			color(black) size(large) )	
		ytitle("% reform debate speeches", 
			color(black) size(large) )
		
		graphregion( fcolor(white) lcolor(white) ) 
		plotregion( fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
		
		
		
		legend( 
			order(
				1 "% speeches mentioning influence topic"
				3 "% speeches mentioning revolution topic"
				)
			cols(4)
			pos(6)
			
			region( color(none) )
			size(medlarge)
		)


	;
	
# delimit cr



	* export graph
	*-------------

	cd "${output}"
	graph export "Figure_E4.png", replace
	
	






			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	
							 ** TABLES **
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table 1: Riots and police spending
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_1.dta, clear



* label
*------

label var exp_tot_police_percap 	" % "
label var lno10_x_post 				"\emph{ln}(1 + rioters (10km)) $\times$ Post-1837"
label var lno20_x_post 				"\emph{ln}(1 + rioters (20km)) $\times$ Post-1837"
label var lno30_x_post 				"\emph{ln}(1 + rioters (30km)) $\times$ Post-1837"
label var rioters10_i_x_post 		"Riot~Treatment (10km) $\times$ Post-1837"
label var rioters20_i_x_post 		"Riot~Treatment (20km) $\times$ Post-1837"
label var rioters30_i_x_post 		"Riot~Treatment (30km) $\times$ Post-1837"
label var rioters10_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (10km) $\times$ Post-1837"
label var rioters20_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (20km) $\times$ Post-1837"
label var rioters30_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (30km) $\times$ Post-1837"
label var rioters10_med_x_post 		"Riot$$ Treatment_{50th}~$$ (10km) $\times$ Post-1837"
label var rioters20_med_x_post 		"Riot$$ Treatment_{50th}~$$ (20km) $\times$ Post-1837"
label var rioters30_med_x_post 		"Riot$$ Treatment_{50th}~$$ (30km) $\times$ Post-1837"
label var rioters10_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (10km) $\times$ Post-1837"
label var rioters20_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (20km) $\times$ Post-1837"
label var rioters30_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (30km) $\times$ Post-1837"
label var p2 						"\emph{ln}(pop) - \emph{ln}(pop\_{min})"
label var post						"Post-1837"
label var lnpopi					"\emph{ln}(Population)"


* tsset
*------

tsset id_muni year 


	
	
* specifications
*---------------

_eststo clear

eststo est_1: reg exp_tot_police_percap lnpopi post rioters10_i_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_2: reg exp_tot_police_percap lnpopi post rioters10_med_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_3: reg exp_tot_police_percap lnpopi post rioters10_75th_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
	
	




* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2
		est_3
		
		
		using "Table_1.tex",  
			b(a2) label replace nogaps r2 compress se(a2) bookt 
			nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment constant substitute(\_ _ \$ $) 
			
			keep(lnpopi post rioters10_i_x_post rioters10_med_x_post 
			rioters10_75th_x_post _cons)
			
			
			stats(		
						N 
						r2
						, 
						
					labels(	"Observations (Borough x Year)"
						"R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr		


	
	
	
	
	
	
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table 2: whig voting
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_2.dta, clear





* specifications
*---------------

_eststo clear


eststo est_1: oprobit vote_1830  share1826 reform_1830 rottenindex c1 lnriots10 ///
										, vce(cluster consid)
												
eststo est_2: oprobit vote_1830  share1826 reform_1830 rottenindex c1 lnriots10 county county_x_lnr10 ///
										, vce(cluster consid)


					
						


* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2
		
		using "Table_2.tex",  
			b(a2) label replace nogaps  compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			keep(  share1826 reform_1830 rottenindex c1 lnriots10
			county county_x_lnr10)
			
			stats(		
						N 
						r2_p
						, 
						
					labels(	"Observations"
						"Pseudo R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr	
	
	
	

			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table 3: swing riots and election outcomes
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_3.dta, clear




* control variables
*------------------

global baseline "share1826 share1826_2 reform_1830 county university narrow rottenindex h_index1831 primary secondary tetitary population1831 density1831 economictrend1 economictrend2" 

global spatial "nearest_pc_km index1 market agg_type1 agg_type2"





* specifications
*---------------

_eststo clear


eststo est_1:	reg forreform lnriots10, cluster(consid)
				estadd local Week_FE "": est_1
				estadd local Constituency_FE "": est_1
				estadd local Controls "": est_1
				estadd local Type "Cross-Sec.": est_1

eststo est_2:	reg forreform lnriots10 $baseline $spatial, cluster(consid)
				estadd local Week_FE "": est_2
				estadd local Constituency_FE "": est_2
				estadd local Controls "\checkmark": est_2
				estadd local Type "Cross-Sec.": est_2

eststo est_3:	reg pet_place lnriots10, cluster(consid)
				estadd local Week_FE "": est_3
				estadd local Constituency_FE "": est_3
				estadd local Controls "": est_3
				estadd local Type "Cross-Sec.": est_3

eststo est_4:	reg pet_place lnriots10 $baseline $spatial, cluster(consid)
				estadd local Week_FE "": est_4
				estadd local Constituency_FE "": est_4
				estadd local Controls "\checkmark": est_4
				estadd local Type "Cross-Sec.": est_4
				

				
* use
*----

cd "${data}"
use Table_3_panel.dta, clear




* label
*------

label var pet_place "Petitions(Place)"
label var lnriots10 "\emph{ln}(1 + rioters (10km))"
label var lnriots20 "\emph{ln}(1 + rioters (20km))"				
label var lnriots30 "\emph{ln}(1 + rioters (30km))"

tsset week consid 




* specifications
*---------------

eststo est_5:  xi: reg pet_place lnriots10 i.week $baseline $spatial, robust
				estadd local Week_FE "\checkmark": est_5
				estadd local Constituency_FE "": est_5
				estadd local Controls "\checkmark": est_5
				estadd local Type "Panel": est_5
				
			
			
				

* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2
		est_3
		est_4
		est_5
		
		using "Table_3.tex",  
			b(a2) label replace nogaps  compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			keep(lnriots10)
			
			
			stats(		
						N 
						r2_a
						Type
						Week_FE
						Controls
						, 
						
					labels(	"Observations"
						"Adj. R-Sqrd"
						"Specification"
						"Week FE"
						"AF Controls"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr						
				

				
				


			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	
					    ** APPENDIX TABLES **
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table B1: riots and reform bills in the newspaper
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_B1.dta, clear




* label for table
*----------------

label var riots "$ riots_{t}$"
label var riots_fd "$\Delta (riots_{t} - riots_{t-1})$"
label var GTYP "$ riots_{t}$ (Horn \& Tilly)"





* regressions
*------------

_eststo clear

eststo est_1:	reg bills_total 		riots 	if year <= 1832		, robust
				estadd local years "1750-1832": est_1
				
eststo est_2:	reg bills_total 		riots_fd if year <= 1832 , robust
				estadd local years "1750-1832": est_2
				
eststo est_3:	reg bills_total 		GTYP 	if year <= 1832	& year >= 1800	, robust
				estadd local years "1800-1832": est_3


eststo est_4:	reg reform 		riots 	if year <= 1832		, robust
				estadd local years "1750-1832": est_4
				
eststo est_5:	reg reform 		riots_fd if year <= 1832 , robust
				estadd local years "1750-1832": est_5
				
eststo est_6:	reg reform 		GTYP 	if year <= 1832	& year >= 1800	, robust
				estadd local years "1800-1832": est_6
				
				
				
* output to table
*----------------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2			
		est_3

		est_4
		est_5
		est_6
		
		using "Table_B1.tex",  
			b(a2) label replace nogaps compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			
			stats(	N years
						, 
						
				labels(	"Obsv. (Years)"  "Year range"
					
						) 
					)
			title("")
			nomtitles
			
		;
		
	#delimit cr
	
				
	
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table D1: Riots and police spending full sample
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_D1.dta, clear



* label
*------

label var exp_tot_police_percap 	" % "
label var lno10_x_post 				"\emph{ln}(1 + rioters (10km)) $\times$ Post-1837"
label var lno20_x_post 				"\emph{ln}(1 + rioters (20km)) $\times$ Post-1837"
label var lno30_x_post 				"\emph{ln}(1 + rioters (30km)) $\times$ Post-1837"
label var rioters10_i_x_post 		"Riot~Treatment (10km) $\times$ Post-1837"
label var rioters20_i_x_post 		"Riot~Treatment (20km) $\times$ Post-1837"
label var rioters30_i_x_post 		"Riot~Treatment (30km) $\times$ Post-1837"
label var rioters10_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (10km) $\times$ Post-1837"
label var rioters20_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (20km) $\times$ Post-1837"
label var rioters30_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (30km) $\times$ Post-1837"
label var rioters10_med_x_post 		"Riot$$ Treatment_{50th}~$$ (10km) $\times$ Post-1837"
label var rioters20_med_x_post 		"Riot$$ Treatment_{50th}~$$ (20km) $\times$ Post-1837"
label var rioters30_med_x_post 		"Riot$$ Treatment_{50th}~$$ (30km) $\times$ Post-1837"
label var rioters10_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (10km) $\times$ Post-1837"
label var rioters20_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (20km) $\times$ Post-1837"
label var rioters30_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (30km) $\times$ Post-1837"
label var p2 						"\emph{ln}(pop) - \emph{ln}(pop\_{min})"
label var post						"Post-1837"
label var lnpopi					"\emph{ln}(Population)"



* tsset
*------

tsset id_muni year 	
	
	
	
	
* specifications
*---------------

_eststo clear

eststo est_1: reg exp_tot_police_percap lnpopi post rioters10_i_x_post  i.id_muni	///
					if sample2 == 1 & year >= 1831,  vce(cl id_muni)
eststo est_2: reg exp_tot_police_percap lnpopi post rioters10_med_x_post  i.id_muni	///
					if sample2 == 1 & year >= 1831,  vce(cl id_muni)
eststo est_3: reg exp_tot_police_percap lnpopi post rioters10_75th_x_post  i.id_muni	///
					if sample2 == 1 &  year >= 1831,  vce(cl id_muni)
	
	




* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2
		est_3
		
		
		using "Table_D1.tex",  
			b(a2) label replace nogaps r2 compress se(a2) bookt 
			nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment constant substitute(\_ _ \$ $) 
			
			keep(lnpopi post rioters10_i_x_post rioters10_med_x_post 
			rioters10_75th_x_post _cons)
			
			
			stats(		
						N 
						r2
						, 
						
					labels(	"Observations (Borough x Year)"
						"R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr	
	
	
	
	
	
	
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table D2: Riots and police spending other distances
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_D2.dta, clear



* label
*------

label var exp_tot_police_percap 	" % "
label var lno10_x_post 				"\emph{ln}(1 + rioters (10km)) $\times$ Post-1837"
label var lno20_x_post 				"\emph{ln}(1 + rioters (20km)) $\times$ Post-1837"
label var lno30_x_post 				"\emph{ln}(1 + rioters (30km)) $\times$ Post-1837"
label var rioters10_i_x_post 		"Riot~Treatment (10km) $\times$ Post-1837"
label var rioters20_i_x_post 		"Riot~Treatment (20km) $\times$ Post-1837"
label var rioters30_i_x_post 		"Riot~Treatment (30km) $\times$ Post-1837"
label var rioters10_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (10km) $\times$ Post-1837"
label var rioters20_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (20km) $\times$ Post-1837"
label var rioters30_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (30km) $\times$ Post-1837"
label var rioters10_med_x_post 		"Riot$$ Treatment_{50th}~$$ (10km) $\times$ Post-1837"
label var rioters20_med_x_post 		"Riot$$ Treatment_{50th}~$$ (20km) $\times$ Post-1837"
label var rioters30_med_x_post 		"Riot$$ Treatment_{50th}~$$ (30km) $\times$ Post-1837"
label var rioters10_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (10km) $\times$ Post-1837"
label var rioters20_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (20km) $\times$ Post-1837"
label var rioters30_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (30km) $\times$ Post-1837"
label var p2 						"\emph{ln}(pop) - \emph{ln}(pop\_{min})"
label var post						"Post-1837"
label var lnpopi					"\emph{ln}(Population)"



* tsset
*------

tsset id_muni year 	
	
	
	
* specifications
*---------------

	// indicators, other distances
	
eststo est_4: reg exp_tot_police_percap lnpopi post rioters20_i_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_5: reg exp_tot_police_percap lnpopi post rioters20_25th_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)					
eststo est_6: reg exp_tot_police_percap lnpopi post rioters20_med_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)					

eststo est_7: reg exp_tot_police_percap lnpopi post rioters30_i_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_8: reg exp_tot_police_percap lnpopi post rioters30_25th_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_9: reg exp_tot_police_percap lnpopi post rioters30_med_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
					
					
					

* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_4
		est_5
		est_6
		est_7
		est_8
		est_9
		
		
		using "Table_D2.tex",  
			b(a2) label replace nogaps r2 compress se(a2) bookt 
			nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment constant substitute(\_ _ \$ $) 
			
			keep(lnpopi post  
			rioters20_i_x_post rioters20_25th_x_post rioters20_med_x_post 
			rioters30_i_x_post rioters30_25th_x_post
			rioters30_med_x_post _cons)
			
			
			stats(		
						N 
						r2
						, 
						
					labels(	"Observations (Borough x Year)"
						"R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr	


	
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table D3: Riots and police spending intensive margin
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_D3.dta, clear



* label
*------

label var exp_tot_police_percap 	" % "
label var lno10_x_post 				"\emph{ln}(1 + rioters (10km)) $\times$ Post-1837"
label var lno20_x_post 				"\emph{ln}(1 + rioters (20km)) $\times$ Post-1837"
label var lno30_x_post 				"\emph{ln}(1 + rioters (30km)) $\times$ Post-1837"
label var rioters10_i_x_post 		"Riot~Treatment (10km) $\times$ Post-1837"
label var rioters20_i_x_post 		"Riot~Treatment (20km) $\times$ Post-1837"
label var rioters30_i_x_post 		"Riot~Treatment (30km) $\times$ Post-1837"
label var rioters10_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (10km) $\times$ Post-1837"
label var rioters20_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (20km) $\times$ Post-1837"
label var rioters30_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (30km) $\times$ Post-1837"
label var rioters10_med_x_post 		"Riot$$ Treatment_{50th}~$$ (10km) $\times$ Post-1837"
label var rioters20_med_x_post 		"Riot$$ Treatment_{50th}~$$ (20km) $\times$ Post-1837"
label var rioters30_med_x_post 		"Riot$$ Treatment_{50th}~$$ (30km) $\times$ Post-1837"
label var rioters10_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (10km) $\times$ Post-1837"
label var rioters20_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (20km) $\times$ Post-1837"
label var rioters30_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (30km) $\times$ Post-1837"
label var p2 						"\emph{ln}(pop) - \emph{ln}(pop\_{min})"
label var post						"Post-1837"
label var lnpopi					"\emph{ln}(Population)"


* tsset
*------

tsset id_muni year 


	
* specifications
*---------------

	// intensive margin

_eststo clear

eststo est_1: reg exp_tot_police_percap lnpopi post lno10_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_2: reg exp_tot_police_percap lnpopi post lno20_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_3: reg exp_tot_police_percap lnpopi post lno30_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)

	
	
* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2
		est_3
		
		
		using "Table_D3.tex",  
			b(a2) label replace nogaps r2 compress se(a2) bookt 
			nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment constant substitute(\_ _ \$ $) 
			
			keep(lnpopi post lno10_x_post lno20_x_post lno30_x_post _cons)
			
			
			stats(		
						N 
						r2
						, 
						
					labels(	"Observations (Borough x Year)"
						"R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr	
	


	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table EXTRA: Riots and police spending w/o time varying population control
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_1.dta, clear




* label
*------

label var exp_tot_police_percap 	" % "
label var lno10_x_post 				"\emph{ln}(1 + rioters (10km)) $\times$ Post-1837"
label var lno20_x_post 				"\emph{ln}(1 + rioters (20km)) $\times$ Post-1837"
label var lno30_x_post 				"\emph{ln}(1 + rioters (30km)) $\times$ Post-1837"
label var rioters10_i_x_post 		"Riot~Treatment (10km) $\times$ Post-1837"
label var rioters20_i_x_post 		"Riot~Treatment (20km) $\times$ Post-1837"
label var rioters30_i_x_post 		"Riot~Treatment (30km) $\times$ Post-1837"
label var rioters10_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (10km) $\times$ Post-1837"
label var rioters20_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (20km) $\times$ Post-1837"
label var rioters30_25th_x_post 	"Riot$$ Treatment_{25th}~$$ (30km) $\times$ Post-1837"
label var rioters10_med_x_post 		"Riot$$ Treatment_{50th}~$$ (10km) $\times$ Post-1837"
label var rioters20_med_x_post 		"Riot$$ Treatment_{50th}~$$ (20km) $\times$ Post-1837"
label var rioters30_med_x_post 		"Riot$$ Treatment_{50th}~$$ (30km) $\times$ Post-1837"
label var rioters10_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (10km) $\times$ Post-1837"
label var rioters20_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (20km) $\times$ Post-1837"
label var rioters30_75th_x_post 	"Riot$$ Treatment_{75th}~$$ (30km) $\times$ Post-1837"
label var p2 						"\emph{ln}(pop) - \emph{ln}(pop\_{min})"
label var post						"Post-1837"
label var lnpopi					"\emph{ln}(Population)"



* tsset
*------

tsset id_muni year 
	
	
	
	
* specifications
*---------------

	// no population 

_eststo clear	
	
eststo est_1: reg exp_tot_police_percap  post rioters10_i_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_2: reg exp_tot_police_percap  post rioters10_med_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
eststo est_3: reg exp_tot_police_percap  post rioters10_75th_x_post  i.id_muni	///
					if sample == 1 & year >= 1831,  vce(cl id_muni)
	
	
	
	

* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2
		est_3
		
		
		using "Table_1_EXTRA_nopopcontrol.tex",  
			b(a2) label replace nogaps r2 compress se(a2) bookt 
			nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment constant substitute(\_ _ \$ $) 
			
			keep( post rioters10_i_x_post rioters10_med_x_post rioters10_75th_x_post _cons)
			
			
			stats(		
						N 
						r2
						, 
						
					labels(	"Observations (Borough x Year)"
						"R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr	
	
	
			

			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table F1 (part 1): swing riots and election outcomes
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_F1.dta, clear




* control variables
*------------------

global baseline "share1826 share1826_2 reform_1830 county university narrow rottenindex h_index1831 primary secondary tetitary population1831 density1831 economictrend1 economictrend2"  

global spatial "nearest_pc_km index1 market agg_type1 agg_type2"




* specifications
*---------------
				
eststo est_11:	reg forreform lnriots20, cluster(consid)
				estadd local Week_FE "": est_11
				estadd local Constituency_FE "": est_11
				estadd local Controls "": est_11
				estadd local Type "Cross-Sec.": est_11

eststo est_12:	reg forreform lnriots20 $baseline $spatial, cluster(consid)
				estadd local Week_FE "": est_12
				estadd local Constituency_FE "": est_12
				estadd local Controls "\checkmark": est_12
				estadd local Type "Cross-Sec.": est_12

eststo est_13:	reg pet_place lnriots20, cluster(consid)
				estadd local Week_FE "": est_13
				estadd local Constituency_FE "": est_13
				estadd local Controls "": est_13
				estadd local Type "Cross-Sec.": est_13

eststo est_14:	reg pet_place lnriots20 $baseline $spatial, cluster(consid)
				estadd local Week_FE "": est_14
				estadd local Constituency_FE "": est_14
				estadd local Controls "\checkmark": est_14
				estadd local Type "Cross-Sec.": est_14				
				
				
* use
*----

cd "${data}"
use Table_F1_panel.dta, clear




* label
*------

label var pet_place "Petitions(Place)"

tsset week consid 

label var lnriots10 "\emph{ln}(1 + rioters (10km))"
label var lnriots20 "\emph{ln}(1 + rioters (20km))"				
label var lnriots30 "\emph{ln}(1 + rioters (30km))"



* specifications
*----------------

eststo est_15:  xi: reg pet_place lnriots20 i.week $baseline $spatial, robust
				estadd local Week_FE "\checkmark": est_15
				estadd local Constituency_FE "": est_15
				estadd local Controls "\checkmark": est_15
				estadd local Type "Panel": est_15



* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_11
		est_12
		est_13
		est_14
		est_15
		
		using "Table_F1_part1.tex",  
			b(a2) label replace nogaps  compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			keep(lnriots20)
			
			
			
			title("")
			nomtitles
			
		;
		
	#delimit cr	
	
	
	

			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table F1 (part 2): swing riots and election outcomes
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_F1.dta, clear




* control variables
*------------------

global baseline "share1826 share1826_2 reform_1830 county university narrow rottenindex h_index1831 primary secondary tetitary population1831 density1831 economictrend1 economictrend2" 

global spatial "nearest_pc_km index1 market agg_type1 agg_type2"




* specifications
*---------------
				
		
eststo est_21:	reg forreform lnriots30, cluster(consid)
				estadd local Week_FE "": est_21
				estadd local Constituency_FE "": est_21
				estadd local Controls "": est_21
				estadd local Type "Cross-Sec.": est_21

eststo est_22:	reg forreform lnriots30 $baseline $spatial, cluster(consid)
				estadd local Week_FE "": est_22
				estadd local Constituency_FE "": est_22
				estadd local Controls "\checkmark": est_22
				estadd local Type "Cross-Sec.": est_22

eststo est_23:	reg pet_place lnriots30, cluster(consid)
				estadd local Week_FE "": est_23
				estadd local Constituency_FE "": est_23
				estadd local Controls "": est_23
				estadd local Type "Cross-Sec.": est_23

eststo est_24:	reg pet_place lnriots30 $baseline $spatial, cluster(consid)
				estadd local Week_FE "": est_24
				estadd local Constituency_FE "": est_24
				estadd local Controls "\checkmark": est_24
				estadd local Type "Cross-Sec.": est_24
				
				
				
				
* use
*----

cd "${data}"
use Table_F1_panel.dta, clear




* label
*------

label var pet_place "Petitions(Place)"
label var lnriots10 "\emph{ln}(1 + rioters (10km))"
label var lnriots20 "\emph{ln}(1 + rioters (20km))"				
label var lnriots30 "\emph{ln}(1 + rioters (30km))"

tsset week consid 





* specifications
*----------------

eststo est_25:  xi: reg pet_place lnriots30 i.week $baseline $spatial, robust
				estadd local Week_FE "\checkmark": est_25
				estadd local Constituency_FE "": est_25
				estadd local Controls "\checkmark": est_25
				estadd local Type "Panel": est_25



	
* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_21
		est_22
		est_23
		est_24
		est_25
		
		using "Table_F1_part2.tex",  
			b(a2) label replace nogaps  compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			keep(lnriots30)
			
			
			stats(		
						N 
						r2_a
						Type
						Week_FE
						Controls
						, 
						
					labels(	"Observations"
						"Adj. R-Sqrd"
						"Specification"
						"Week FE"
						"AF Controls"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr		
		



			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	


*-------------------------------------------------------------------------------
* Table G1: swing riots and election outcomes
*-------------------------------------------------------------------------------


* use
*----

cd "${data}"
use Table_G1.dta, clear




* global
*-------

global demography_1831 "population_31 density_31 primary_1831 secondary_1831 h_index_31" 


* label
*------

label var constriots10 "Riots 10km"
label var share1830 "1830 Whig Seat Share"
label var share1826 "1826 Whig Seat Share"
label var share1831 "1831 Whig Seat Share"
label var share1832 "1832 Whig Seat Share"



* specifications
*---------------

eststo est_1: reg share1831 constriots10 $demography_1831, robust

eststo est_2: reg share1831 constriots10 share1830 $demography_1831, robust

eststo est_3: reg share1831 constriots10 share1826 $demography_1831, robust




* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_1
		est_2
		est_3

		
		using "Table_G1_part1.tex",  
			b(a2) label replace nogaps  compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			keep(constriots10 share1830 share1826)
			
			
			stats(		
						N 
						r2_a

						, 
						
					labels(	"Observations"
						"Adj. R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr
	

	
* specifications
*---------------


eststo est_4: reg share1832 constriots10 $demography_1831, robust

eststo est_5: reg share1832 constriots10 share1831 $demography_1831, robust

eststo est_6: reg share1832 constriots10 share1826 $demography_1831, robust




* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_4
		est_5
		est_6

		
		using "Table_G1_part2.tex",  
			b(a2) label replace nogaps  compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			keep(constriots10 share1831 share1826)
			
			
			stats(		
						N 
						r2_a

						, 
						
					labels(	"Observations"
						"Adj. R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr


* specifications
*---------------

eststo est_7: reg share1835 constriots10 $demography_1831, robust

eststo est_8: reg share1835 constriots10 share1832 $demography_1831, robust 

eststo est_9: reg share1835 constriots10 share1826 $demography_1831, robust





* table
*------

	cd "${output}"

	#delimit;
	
	esttab 
	
		est_7
		est_8
		est_9

		
		using "Table_G1_part3.tex",  
			b(a2) label replace nogaps  compress se(a2) bookt 
			noconstant nodepvars star(* 0.1 ** 0.05 *** 0.01)
			fragment  substitute(\_ _)
			keep(constriots10 share1832 share1826)
			
			
			stats(		
						N 
						r2_a

						, 
						
					labels(	"Observations"
						"Adj. R-Sqrd"
						) 
				)
			title("")
			nomtitles
			
		;
		
	#delimit cr
	

	
	
	
	

	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			
			
					 ** end of replication file **



